﻿// Study0304.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//第三章：函数
// 寻找并输出11~999之间的数m，它满足m，m^2,m^3，均为回文数

#include <iostream>
using namespace std;
bool Issymm(unsigned long n) {
	unsigned long i = n;
	unsigned long m = 0;
	while (i>0)
	{
		m = m * 10 + i % 10;
		i /= 10;
	}
	return (m==n);

}

int main()
{
	for (unsigned int i = 11; i <=999; i++)
	{
		long m = i * i;
		long n = i * i * i;
		bool b = Issymm(i) && Issymm(m) && Issymm(n);
		
		if (b)
		{
			cout << "回文数为：" << i<<"," << m << "," << n<< "."<<endl;
		}
	}
	return 0;
}


